<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .box {
            position: relative;
            width: 100px;
            height: 100px;
            background-color: brown;
        }
        
        .box:hover .b {
            margin-top: 100px;
        }
        
        .box:hover .a {
            margin-left: 100px;
        }
        
        .a {
            width: 100px;
            height: 100px;
            position: absolute;
            background-color: black;
            transition: 2s ease;
        }
        
        .b {
            width: 100px;
            height: 100px;
            position: absolute;
            background-color: aquamarine;
            transition: 2s ease;
        }
    </style>
</head>



<body>
    <div class="box">
        <div class="a">

        </div>
        <div class="b">

        </div>
    </div>



</body>

</html>